
import random


class Array:
    '''
    生成给定长度的随机整型数组。
    可选择是否重复
    '''
    @staticmethod
    def randomNumberList(len: int, low: int, hight: int, distinct: bool = False):
        try:
            res = []
            if len <= 0 or low > hight:
                return res
            
            if distinct == False:
                for i in range(0, len):
                    num = random.randint(low, hight)
                    res.append(num)
            else:
                for i in range(0, len):
                    num = random.randint(low, hight)
                    while num in res:
                        num = random.randint(low, hight)
                    res.append(num)

            return res
        except Exception as e:
            raise e